package com.tac.service.wms.impl;

import com.tac.common.result.Result;
import com.tac.dao.wms.VehicleDispatchDetailsDao;
import com.tac.pojo.wms.VehicleDispatchDetails;
import com.tac.service.wms.VehicleDispatchDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VehicleDispatchDetailsServiceImpl implements VehicleDispatchDetailsService {

    @Autowired
    private VehicleDispatchDetailsDao vehicleDispatchDetailsDao;



    // 车辆调度明细添加
    public Result save(VehicleDispatchDetails vehicleDispatchDetails) {
        int count = vehicleDispatchDetailsDao.save(vehicleDispatchDetails);
        if (count > 0) {
            return Result.success(vehicleDispatchDetails.getId());
        } else {
            return Result.error("添加失败");
        }
    }

    // 车辆调度明细删除
    public Result remove(List<Integer> ids) {
        int count = vehicleDispatchDetailsDao.remove(ids);
        if (count > 0) {
            return Result.success(null);
        } else {
            return Result.error("删除失败");
        }
    }

    // 车辆调度明细修改
    public Result update(VehicleDispatchDetails vehicleDispatchDetails) {
        int count = vehicleDispatchDetailsDao.update(vehicleDispatchDetails);
        if (count > 0) {
            return Result.success(null);
        } else {
            return Result.error("更新失败");
        }
    }
}
